package com.gamex.findit.service.impl;

import java.util.List;

import javax.xml.stream.events.Characters;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gamex.findit.dao.CharacterMapper;
import com.gamex.findit.model.Character;
import com.gamex.findit.service.CharacterService;

/**
 * 캐릭터
 * @author james
 *
 */
@Service
public class CharacterServiceImpl implements CharacterService{
	
	private static final Logger logger = LoggerFactory.getLogger(CharacterServiceImpl.class);

	@Autowired CharacterMapper characterMapper;
	
	@Override
	public List<Character> getCharacter(Character charId) {
		List<Character> result = null;
		try {
			result = characterMapper.selectCharacter(charId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return result;
	}

	@Override
	public int getCharacterCount(Character Character) {
		int count = 0;
		try {
			count = characterMapper.selectCharacterCount(Character);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return count;
	}

	@Override
	public Character getCharacterView(int charId) {
		Character result = null;
		try {
			result = characterMapper.selectCharacterView(charId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		return result;
	}

	@Override
	public void insertCharacter(Character charId) {
		try {
			characterMapper.insertCharacter(charId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
	}

	@Override
	public void updateCharacter(Character character) {
		try {
			characterMapper.updateCharacter(character);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		
	}

	@Override
	public void deleteCharacter(int charId) {
		try {
			characterMapper.deleteCharacter(charId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		
	}

}
